import { describe, it, expect } from 'vitest'
import removeTrailingZeros from './removeTrailingZeros'

describe('removeTrailingZerosRegex', () => {
  it.each([
    ['0', '0'],
    ['000000', '000000'],
    ['10', '10'],
    ['1', '1'],
    ['0.10000', '0.1'],
    ['5.12300', '5.123'],
    ['73.703906518900947020', '73.70390651890094702'],
    ['73.703906518900947029', '73.703906518900947029'],
    ['81.765271294405738100', '81.7652712944057381'],
    ['81.76527129440000', '81.7652712944'],
    ['1000000000000', '1000000000000'],
    ['1999128392', '1999128392'],
    ['10000000000000', '10000000000000'],
    ['100000000000000', '100000000000000'],
    ['1000000000000000', '1000000000000000'],
    ['-100000000000000000000', '-100000000000000000000'],
    ['-1000000000000000', '-1000000000000000'],
    ['270000.00000000', '270000'],
  ])('should format "%s" to "%s"', (numberString, expected) => {
    expect(removeTrailingZeros(numberString)).toEqual(expected)
  })
})
